import request from '@/utils/request'

// 查询首页文章列表
export function listHomeArticles(query) {
  return request({
    url: '/cms/frontend/home/list',
    method: 'get',
    params: query
  })
}

// 查询文章列表页数据
export function listArticles(query) {
  return request({
    url: '/cms/frontend/article/list',
    method: 'get',
    params: query
  })
}

// 查询文章详情
export function getArticleDetail(articleId) {
  return request({
    url: '/cms/frontend/article/' + articleId,
    method: 'get'
  })
}

// 搜索文章
export function searchArticles(query) {
  return request({
    url: '/cms/frontend/article/search',
    method: 'get',
    params: query
  })
}

// 查询分类下的文章列表
export function listArticlesByCategory(categoryId, query) {
  return request({
    url: '/cms/frontend/category/' + categoryId + '/articles',
    method: 'get',
    params: query
  })
}

// 查询标签下的文章列表
export function listArticlesByTag(tagId, query) {
  return request({
    url: '/cms/frontend/tag/' + tagId + '/articles',
    method: 'get',
    params: query
  })
}

// 查询评论列表
export function listArticleComments(articleId, query) {
  return request({
    url: '/cms/frontend/article/' + articleId + '/comments',
    method: 'get',
    params: query
  })
}

// 提交评论
export function submitComment(data) {
  return request({
    url: '/cms/frontend/comment',
    method: 'post',
    data: data
  })
}

// 查询网站配置
export function getSiteConfigs() {
  return request({
    url: '/cms/frontend/site/configs',
    method: 'get'
  })
}

// 查询友情链接列表
export function listFriendLinks(query) {
  return request({
    url: '/cms/frontend/friendlink/list',
    method: 'get',
    params: query
  })
}

// 查询分类列表
export function listCategories() {
  return request({
    url: '/cms/frontend/category/list',
    method: 'get'
  })
}

// 查询标签列表
export function listTags() {
  return request({
    url: '/cms/frontend/tag/list',
    method: 'get'
  })
}